<%@page import="clases.Profesor"%>
<%@page import="java.util.Hashtable"%>
<%@page import="clases.Aspirante"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>PIO- Administrador- Lista de  Profesores</title>
    <meta http-equiv="Content-Language" content="English" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="interfaz/style.css" media="screen" />
  </head>
  <%@include file="validacionAdmin.jsp" %>
  <body>
    <div id="wrap">

      <div id="header">
        <!--        <h1><a href="#">Website Title</a></h1>-->
      </div>

      <%@include file="tm.jsp" %>

      <div id="content">
        <div class="right"> 

          <h1>Lista de Profesores</h1>
          <%
            List lista = (List) request.getAttribute("profesores");
            if (lista == null) {
              out.print("Hay algun error");
            } else if (lista.isEmpty()) {
              out.print("No hay profesores.");
            } else {
          %>
          <div class="centrar">
            <table>
              <thead>
                <tr>
                  <th style="width:15%">Cedula</th>
                  <th style="width:22%">Apellidos</th>
                  <th style="width:22%">Nombres</th>                                    
                  <th>Correo</th> 
                  <th style="width:8%">M</th>
                  <th style="width:8%">E</th>
                </tr>
              </thead>
              <tbody>
                <%
                  for (int i = 0; i < lista.size(); i++) {
                    Profesor temp = (Profesor) lista.get(i);
                %>
                <tr>
                  <td><%= temp.getCedula()%> </td>
                  <td><%= temp.getApellidos()%> </td>
                  <td><%= temp.getNombres()%> </td>
                  <td><%= temp.getCorreo()%> </td>
                  <td>
                    <html:form action="/PageModificarProf" method="POST" enctype="multipart/form-data">
                      <html:hidden property="cedula" value="<%= Integer.toString(temp.getCedula())%>"/>
                      <html:submit styleId="modificar"
                                   value=" "
                                   title="Modificar"/>
                    </html:form>
                  </td>
                  <td>
                    <html:form action="/EliminarProf" method="POST" enctype="multipart/form-data">
                      <html:hidden property="cedula" value="<%= Integer.toString(temp.getCedula())%>"/>
                      <html:submit styleId="eliminar"
                                   value=" "
                                   title="Eliminar"
                                   onclick="return confirm('Esta seguro que desea eliminar este profesor?')"/>
                    </html:form>
                  </td>
                </tr>
                <%
                  }
                %>
              </tbody>
            </table>
          </div>
          <% }%>
          <div class="center">
                <input id="boton" type="button" value="Volver atras" onclick="location.href = 'adminProfesor.jsp'"/>
          </div> 
        </div>

        <%@include file="lm.jsp" %>

        <div style="clear: both;"> </div>

      </div>
    </div>

    <%@include file="footer.jsp" %>

  </body>
</html>